﻿using System;
using System.Diagnostics;
using Twitter;

namespace TemperatureBots
{
	public static class Program
	{
		[STAThread]
		public static void Main(string[] args)
		{
			if (args.Length != 4)
			{
				Console.WriteLine("Usage: TemperatureBots.exe [farenheit botUser] [farenheit botPassword] [celsius botUser] [celsius botPassword]");
				Console.ReadLine();
				return;
			}

			BotProcessor processor;

			try
			{
				// Run F2C
				processor = new BotProcessor(
					args[0], 
					args[1], 
					new FahrenheitToCelsiusGreeting(), 
					new FahrenheitToCelsiusMessageProcessor());

				processor.Run();
			}
			catch (Exception ex)
			{
				EventLog.WriteEntry("Application", ex.ToString(), EventLogEntryType.Error);
			}

			try
			{
				// Run C2F
				processor = new BotProcessor(
					args[0], 
					args[1], 
					new CelsiusToFahrenheitGreeting(), 
					new CelsiusToFahrenheitMessageProcessor());

				processor.Run();
			}
			catch (Exception ex)
			{
				EventLog.WriteEntry("Application", ex.ToString(), EventLogEntryType.Error);
			}

			Console.WriteLine("Done");
		}
	}
}
